package com.itheima.mapper;

import com.itheima.pojo.Permission;
import com.itheima.pojo.Role;
import com.itheima.pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Set;

@Mapper
public interface UserMapper {
    /**
     * 查询用户
     * @param username
     * @return
     */
    @Select("select * from user where username=#{username}")
    User findByUsername(String username);

    /**
     *  用户id查相关联的角色
     * @param id
     * @return
     */

    Set<Role> findRoleByUserId(Integer id);

    /**
     *角色id查询关联权限
     * @param id
     * @return
     */
    Set<Permission> findPermissionByRoleId(Integer id);
}
